package com.link2room.jetfire;

import com.link2room.common.mns.Worker;
import com.link2room.common.mns.listener.MnsListener;
import com.link2room.jetfire.constant.JetfireMnsConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 加载mns消息服务轮询服务
 * Created by LN on 2016/8/25.
 */
@Component  //使用时，打开注释
public class JetfireMNSPollingStartupRunner implements CommandLineRunner {

    @Resource //需要实现此接口
    private Worker reservationNmsStaRunner;
    @Resource //需要实现此接口
    private Worker reservationConfirmStaRunner;
    @Resource //需要实现此接口
    private Worker reservationSavePayToPmsRunner;
    @Resource
    private MnsListener defaultMnsListener;

    private static Logger logger = LoggerFactory.getLogger(JetfireMNSPollingStartupRunner.class);
    @Override
    public void run(String... strings) throws Exception {
        defaultMnsListener.startPolling(JetfireMnsConstant.QUEUE_ORDER_STA,reservationNmsStaRunner);
        defaultMnsListener.startPolling(JetfireMnsConstant.QUEUE_ORDER_CONFIRMSTA,reservationConfirmStaRunner);
        defaultMnsListener.startPolling(JetfireMnsConstant.QUEUE_ORDER_SAVEPAY,reservationSavePayToPmsRunner);
    }
}
